<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>手动跳转</title>
        <style>
            .container {
                text-align: center;
                padding: 50px;
                font-family: Arial, sans-serif;
            }
            button {
                padding: 12px 24px;
                font-size: 16px;
                background: #88b04b;
                color: white;
                border: none;
                border-radius: 4px;
                cursor: pointer;
            }
            button:disabled {
                background: #cccccc;
                cursor: not-allowed;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <p>点击下方按钮打开新窗口</p>
            <button id="openBtn" onclick="handleRedirect()">立即跳转</button>
            <p id="loading" style="display:none; color:#666;">正在打开...</p>
        </div>
        <script>
            const decodedUrl = "{{{decodedUrl}}}";
            function handleRedirect() {
                const btn = document.getElementById('openBtn');
                const loading = document.getElementById('loading');

                // 禁用按钮防止重复点击
                btn.disabled = true;
                loading.style.display = 'block';

                // 创建新窗口
                const newWindow = window.open('', '_blank');

                // 加载目标页面
                newWindow.location.href = decodedUrl;

                // 监听窗口关闭事件（可选）
                const checkWindow = setInterval(() => {
                    if (newWindow.closed) {
                        clearInterval(checkWindow);
                        console.log('新窗口已关闭');
                    }
                }, 1000);
            }
        </script>
    </body>
</html>
